import 'package:flutter/material.dart';
import 'package:open_source_china/constants/size_list.dart';

class Avatar extends StatelessWidget {
  String path;
  double width;
  Avatar({this.path, this.width = SizeList.AVATAR_SIZE});
  @override
  Widget build(BuildContext context) {
    return ClipRRect(
      borderRadius: BorderRadius.circular(SizeList.AVATAR_SIZE / 2),
      child: path != null && path.length != 0 && path.contains("http")
          ? Image.network(
              path,
              width: width,
              fit: BoxFit.cover,
            )
          : Image.asset(
              "lib/assets/images/avatar.png",
              width: width,
              fit: BoxFit.cover,
            ),
    );
  }
}
